package my.peerencrypt;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class Server extends Thread {
	
	private ServerSocket server;;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Server server = new Server();
		server.start();
	}
	
	public Server(){
		
		try {
			server = new ServerSocket();
			server.bind(new InetSocketAddress("127.0.0.1", 7878));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public void run(){
		
		Socket socket = null;
		try {
			while((socket = server.accept())!=null){
				new ServerThread(socket).start();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
}
